import Tkinter
import Canvas

root = Tkinter.Tk()
root.title("Control loop demo control application")
#Tkinter.Label(root,text='This is the Toplevel').pack(pady=10)

canvas = Canvas.Canvas(root)
canvas["height"]=800
canvas["width"]=800
canvas["borderwidth"]=2
canvas.pack()

x = 40;
oval = Canvas.Oval(canvas,x-3,400-3,x+3,400+3)
rect = Canvas.Rectangle(canvas,0,200,x,240)

def onTimer():
	global x,oval
	x = x + 1
	x = x % 800
	
	#Changing position of oval without MoveTo
	coords = canvas.coords(oval)
	canvas.coords(oval,x-3, coords[1], x+3, coords[3])
	
	#Changing position of rectangle without moveto
	coords = canvas.coords(rect)
	canvas.coords(rect,coords[0], coords[1], x*2, coords[3])	
	
	root.after(50, onTimer)

onTimer()

print oval.keys()

root.mainloop()